<script>
import {login} from './api/index';
	export default {
		onLaunch: function() {
			return new Promise((resolve,reject)=>{
				wx.login({
					success:async res=>{
						let result = await login(res.code);
						if(result.code === 0){
							wx.setStorageSync('openid',result.data.openid)
						}else{
							wx.showToast({
								title:result.msg,
								icon:'none',
								mask:true
							})
						}
					},
					fail:(error)=>{
						wx.showToast({
							title:error,
							icon:'none',
							mask:true
						})
					},
					complete:()=>{

					}
				})
			})
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	page{
		height:100%
	}
</style>
